<template>
	<view class="mainbgc">
		<header-top :messageInfo="{typeFlag:true,message:'账号管理',liner:false}"></header-top>
		<view class="mainpadding_top ffffff flexbetween">
			<view class="flexleft">
				<view class="headimage margin_right">
					<image :src="user_info.avatar" mode=""></image>
				</view>
				<view class="titletext">{{user_info.name}}</view>
			</view>
			<view class="flexright">
				<view class="dian margin_right"></view>
				<view class="nostrongtext">当前登录</view>
			</view>
		</view>
		<view class="mainpadding">
			<view class="surebtns flexcenter margin_top" @click="jumppass">修改密码</view>
			<view class="resetbtn margin_top flexcenter" @click="show=true">退出登录</view>
		</view>
		<!-- //弹出层 -->
		<u-modal :show="show" title="是否退出登录" confirmColor="#0BBDCB" :showCancelButton='true' @confirm="confirm"
			@cancel="show=false"></u-modal>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				user_info:{},
				show:false,
			}
		},
		onLoad() {
			this.userxinxi()
		},
		methods: {
			userxinxi() {
				httpRequest.request('appapi/manage/user/info', 'POST', {
					// 传参
				}, false, false, true).then(res => {
					if(res.code == 1){
						this.user_info = res.data.user_info
					}
				})
			},
			jumppass(){
				uni.navigateTo({
					url:"/pages/mypage/changepassword"
				})
			},
			confirm() {
				this.show = false;
				// 将存储的数据改为空达到退出登录的效果
				uni.setStorageSync('token', "");
				// uni.setStorageSync('user_id', "");
				httpRequest.toast("退出登录成功")
				setTimeout(() => {
					uni.reLaunch({
						url:"/pages/login/accountlogin"
					})
				}, 1000)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.headimage{
		width: 88rpx;
		height: 88rpx;
		border-radius: 50%;
		image{
			width: 100%;
			height: 100%;
			border-radius: 50%;
		}
	}
	.dian{
		width: 10rpx;
		height: 10rpx;
		border-radius: 50%;
		background-color: #00B855;
	}
	.resetbtn{
		background-color: #fff;
	}
</style>
